/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author ivanhoe
 */
@Entity
@Table(name = "cargas")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Cargas.findAll", query = "SELECT c FROM Cargas c"),
    @NamedQuery(name = "Cargas.findByIdCarga", query = "SELECT c FROM Cargas c WHERE c.idCarga = :idCarga"),
    @NamedQuery(name = "Cargas.findByDescripcion", query = "SELECT c FROM Cargas c WHERE c.descripcion = :descripcion")})
public class Cargas implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_carga")
    private Integer idCarga;
    @Size(max = 45)
    @Column(name = "descripcion")
    private String descripcion;
    @JoinColumn(name = "fletes_id_flete", referencedColumnName = "id_flete")
    @ManyToOne(optional = false)
    private Fletes fletesIdFlete;

    public Cargas() {
    }

    public Cargas(Integer idCarga) {
        this.idCarga = idCarga;
    }

    public Integer getIdCarga() {
        return idCarga;
    }

    public void setIdCarga(Integer idCarga) {
        this.idCarga = idCarga;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public Fletes getFletesIdFlete() {
        return fletesIdFlete;
    }

    public void setFletesIdFlete(Fletes fletesIdFlete) {
        this.fletesIdFlete = fletesIdFlete;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCarga != null ? idCarga.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cargas)) {
            return false;
        }
        Cargas other = (Cargas) object;
        if ((this.idCarga == null && other.idCarga != null) || (this.idCarga != null && !this.idCarga.equals(other.idCarga))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.Cargas[ idCarga=" + idCarga + " ]";
    }
    
}
